# -*- mode: cmake -*-
# - Finds AliROOT instalation


set(ALICE_ROOT $ENV{ALICE_ROOT})
if(NOT ALICE_ROOT)
  set(ALICE_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
#   message(STATUS "Setting \$ALICE_ROOT to ${CMAKE_CURRENT_SOURCE_DIR} ... ")
endif(NOT ALICE_ROOT)

set(ALICE_TARGET $ENV{ALICE_TARGET})
if(NOT ALICE_TARGET)
  Execute_process(COMMAND root-config --arch OUTPUT_VARIABLE ALICE_TARGET OUTPUT_STRIP_TRAILING_WHITESPACE)
endif(NOT ALICE_TARGET)

if(NOT ALICE_ROOT)
  message(FATAL_ERROR "\$ALICE_ROOT was NOT found ... ")
else(NOT ALICE_ROOT)
  message(STATUS "Setting \$ALICE_ROOT is ${ALICE_ROOT} ... ")
endif(NOT ALICE_ROOT)
  
if(NOT ALICE_TARGET)
  message(FATAL_ERROR "\$ALICE_TARGET was NOT found ... ")
else(NOT ALICE_TARGET)
  message(STATUS "Setting \$ALICE_TARGET is ${ALICE_TARGET} ... ")
endif(NOT ALICE_TARGET)

Set(ALIROOT_LIBRARY_DIR ${ALICE_ROOT}/lib/tgt_${ALICE_TARGET})
Set(ALIROOT_BIN_DIR ${ALICE_ROOT}/bin/tgt_${ALICE_TARGET})
Set(ALIROOT_INCLUDE_DIR ${ALICE_ROOT}/include)

Set(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${ALIROOT_LIBRARY_DIR})
Set(PATH ${PATH} ${ALIROOT_BIN_DIR})

